import .pyplot as plt

# 迭代天数，从 0 到 20（共 21 天）
days = list(range(0, 21))

# 1. 理想情况下（Ideal）的“剩余任务量” - 目测/公式计算
#    这里用线性下降: 30 -> 0
ideal_remaining = [30 - 1.5*d for d in days]

# 2. 实际情况下（Actual）的“剩余任务量” - 目测估计
#    如有更精确数据，请在这里替换
actual_remaining = [
    30, 29, 28, 27, 26,
    25, 24, 22, 20, 18,
    16, 14, 13, 10,  8,
     5,  4,  3,  2,  1,
     0
]

# 确定“总任务量”
total_tasks = 30

# -----------------------------
# 3. 将“剩余任务量”转化为“已完成任务量”
# -----------------------------
ideal_completed = [total_tasks - r for r in ideal_remaining]
actual_completed = [total_tasks - r for r in actual_remaining]

# -----------------------------
# 4. 绘制燃起图（Burn-Up Chart）
# -----------------------------
plt.figure(figsize=(8, 5))

# 绘制理想完成曲线（红色）
plt.plot(days, ideal_completed, marker='o', color='red', label='Ideal Completed')

# 绘制实际完成曲线（蓝色）
plt.plot(days, actual_completed, marker='o', color='blue', label='Actual Completed')

# 添加标题、坐标轴标签、图例等
plt.title('Project XYZ Iteration 1 Burn-Up Chart')
plt.xlabel('Iteration Timeline (days)')
plt.ylabel('Tasks Completed')
plt.xlim(0, 20)
plt.ylim(0, total_tasks)
plt.legend()
plt.grid(True, linestyle='--', alpha=0.5)

plt.show()
